import fetch from "common/src/utils/fetch";

/**
 *  分页学生绩点及排名
 */
function queryList(data) {
  return fetch({
    url: "/api/majorservice/gpaRankingQuery/list",
    method: "post",
    data
  });
}

/**
 *  根据年级获取学堂集合
 */
function getSchoolListByGrade(data) {
  return fetch({
    url: "/api/majorservice/gpaRankingQuery/getSchoolListByGrade",
    method: "post",
    data
  });
}

/**
 *  同步绩点
 */
function updateGrade(data) {
  return fetch({
    url: "/api/majorservice/gpaRankingQuery/updateGrade",
    method: "post",
    data
  });
}

/**
 *  导出学生绩点及排名
 */
function exportQuery(data) {
  return fetch({
    url: "/api/majorservice/gpaRankingQuery/export",
    method: "post",
    data
  });
}

/**
 *  导出学生绩点及排名(勾选导出)
 */
function exportSelectList(data) {
  return fetch({
    url: "/api/majorservice/gpaRankingQuery/exportSelectList",
    method: "post",
    data
  });
}

function getReportStatus(key) {
  return fetch({
    url: `/api/majorservice/common/exportExcelResult/${key}`,
    method: 'get'
  });
}

/**
 * 获取 key
 */
function getAutoExamKey(key) {
  return fetch({
    url:
      "/api/majorservice/gpaRankingQuery/findUpdateGradeStatus?key=" +
      key,
    method: "get"
  });
}

export default {
  queryList: queryList,
  getSchoolListByGrade: getSchoolListByGrade,
  exportQuery: exportQuery,
  updateGrade: updateGrade,
  exportSelectList: exportSelectList,
  getReportStatus: getReportStatus,
  getAutoExamKey: getAutoExamKey
};
